tidy readability-convert-member-functions-to-static
authortsteven4 <13596209+tsteven4@users.noreply.github.com>
Thu, 28 Jan 2021 15:37:13 +0000 (08:37 -0700)
committertsteven4 <13596209+tsteven4@users.noreply.github.com>
Thu, 28 Jan 2021 15:37:13 +0000 (08:37 -0700)
this took a little bit of hand editing for whitespace and
one change that had to be reverted wrt a Functor signature.

20 files changed:
dg-100.cc
dg-100.h
duplicate.h
geojson.h
gpx.cc
gpx.h
height.h
kml.cc
kml.h
lowranceusr.cc
lowranceusr.h
osm.cc
osm.h
polygon.h
position.h
radius.h
smplrout.h
trackfilter.h
unicsv.cc
unicsv.h

index a9f47e7daa5f2b3bd876f45f2a76ee50122a1188..e452997c0e31b72df210664b7e7e8a78a42aad93 100644 (file)
--- a/dg-100.cc
+++ b/dg-100.cc
@@ -145,7 +145,7 @@ Dg100Format::dg100_log(const char* fmt, ...)
 
 /* TODO: check whether negative lat/lon (West/South) are handled correctly */
 float
-Dg100Format::bin2deg(int val) const
+Dg100Format::bin2deg(int val)
 {
   /* Assume that val prints in decimal digits as [-]dddmmffff
    * ddd:  degrees
index c147a9c840d6f2589aa2bf9a11d6a59995e26e72..9e09db46ec7e91dcd9218d666e21809384568c38 100644 (file)
--- a/dg-100.h
+++ b/dg-100.h
@@ -121,7 +121,7 @@ protected:
   static QDateTime bintime2utc(int date, int time);
   static void dg100_debug(const char* hdr, int include_nl, size_t sz, unsigned char* buf);
   static void dg100_log(const char* fmt, ...);
-  float bin2deg(int val) const;
+  static float bin2deg(int val);
   void process_gpsfile(uint8_t* data, route_head** track) const;
   static uint16_t dg100_checksum(const uint8_t* buf, int count);
   size_t dg100_send(uint8_t cmd, const void* payload, size_t param_len) const;
index d7fba88d837011d968c48ff0538b76ae08bbadde..1cce5102915d6d3e3300b06ed257d2fb766be90c 100644 (file)
@@ -70,7 +70,7 @@ private:
     Waypoint* wpt;
   };
 
-  btree_node* addnode(btree_node* tree, btree_node* newnode, btree_node** oldnode);
+  static btree_node* addnode(btree_node* tree, btree_node* newnode, btree_node** oldnode);
   void free_tree(btree_node* tree);
 
   struct wpt_ptr {
index c8285351f3ccf64125a0d1d97360824c6f249711..26c729dbb42a9eed7e3e2b911e23b7b85ef1c2d3 100644 (file)
--- a/geojson.h
+++ b/geojson.h
@@ -71,7 +71,7 @@ private:
 
   void geojson_waypt_pr(const Waypoint* waypoint) const;
   static Waypoint* waypoint_from_coordinates(const QJsonArray& coordinates);
-  void routes_from_polygon_coordinates(const QJsonArray& polygon);
+  static void routes_from_polygon_coordinates(const QJsonArray& polygon);
   void geojson_track_hdr(const route_head* track);
   void geojson_track_disp(const Waypoint* trackpoint) const;
   void geojson_track_tlr(const route_head* unused);
diff --git a/gpx.cc b/gpx.cc
index 1300d49a842c25129bcd7700c366da75a7c4dc05..221415a899046dd06f6e122099f65eb17b97f06c 100644 (file)
--- a/gpx.cc
+++ b/gpx.cc
@@ -71,12 +71,12 @@ GpxFormat::gpx_add_to_global(QStringList& ge, const QString& s)
 // Temporarily mock the old GPX writer's hardcoded fixed length for float/double
 // types.  This can be removed once we have time/interest in regenerating all our
 // zillion reference files.
-inline QString GpxFormat::toString(double d) const
+inline QString GpxFormat::toString(double d)
 {
   return QString::number(d, 'f', 9);
 }
 
-inline QString GpxFormat::toString(float f) const
+inline QString GpxFormat::toString(float f)
 {
   return QString::number(f, 'f', 6);
 }
diff --git a/gpx.h b/gpx.h
index 4247afe53d7518c4c26966e04b7a4a887ea7fffb..be887cba5cc870190218e224de8e69f488a73812 100644 (file)
--- a/gpx.h
+++ b/gpx.h
@@ -188,8 +188,8 @@ private:
 
 
   static void gpx_add_to_global(QStringList& ge, const QString& s);
-  inline QString toString(double d) const;
-  inline QString toString(float f) const;
+  static inline QString toString(double d);
+  static inline QString toString(float f);
   void gpx_reset_short_handle();
   void gpx_write_gdata(const QStringList& ge, const QString& tag) const;
   tag_mapping get_tag(const QString& t) const;
index 0339d800db79fd2be2b4d5f23d15ebef868fdb75..5a854ec98b4c080e25da5f901b5e4e1ea8323832 100644 (file)
--- a/height.h
+++ b/height.h
@@ -61,7 +61,7 @@ private:
     },
   };
 
-  double bilinear(double x1, double y1, double x2, double y2, double x, double y, double z11, double z12, double z21, double z22);
+  static double bilinear(double x1, double y1, double x2, double y2, double x, double y, double z11, double z12, double z21, double z22);
   double wgs84_separation(double lat, double lon);
   void correct_height(const Waypoint* wpt);
 
diff --git a/kml.cc b/kml.cc
index 07435c090692cde38813b7db9d61aa0da87a2bf4..12ad2e2ff4cb3550ba88e732961b496d054267dd 100644 (file)
--- a/kml.cc
+++ b/kml.cc
@@ -670,7 +670,7 @@ void KmlFormat::kml_output_header(const route_head* header, const computed_trkda
   }
 }
 
-int KmlFormat::kml_altitude_known(const Waypoint* waypoint) const
+int KmlFormat::kml_altitude_known(const Waypoint* waypoint)
 {
   if (waypoint->altitude == unknown_alt) {
     return 0;
diff --git a/kml.h b/kml.h
index 375d50d08a503ff9c53e25eb2873f36d4932191b..bfa993e4c332c56feebd254b00ece15e57302d06 100644 (file)
--- a/kml.h
+++ b/kml.h
@@ -134,7 +134,7 @@ private:
   static void kml_td(gpsbabel::XmlStreamWriter& hwriter, const QString& data);
   void kml_output_trkdescription(const route_head* header, const computed_trkdata* td) const;
   void kml_output_header(const route_head* header, const computed_trkdata* td) const;
-  int kml_altitude_known(const Waypoint* waypoint) const;
+  static int kml_altitude_known(const Waypoint* waypoint);
   void kml_write_coordinates(const Waypoint* waypointp) const;
   void kml_output_lookat(const Waypoint* waypointp) const;
   void kml_output_positioning(bool tessellate) const;
index 247f23a7f47c2775d4290218330415860839f20d..50d07784b771985f4cc5834074a3555df8c63870 100644 (file)
@@ -150,7 +150,7 @@ LowranceusrFormat::register_waypt(const Waypoint* wpt) const
 /* end borrowed from raymarine.c */
 
 const Waypoint*
-LowranceusrFormat::lowranceusr4_find_waypt(uint uid_unit, int uid_seq_low, int uid_seq_high) const
+LowranceusrFormat::lowranceusr4_find_waypt(uint uid_unit, int uid_seq_low, int uid_seq_high)
 {
   // Iterate with waypt_disp_all?
   for (const Waypoint* waypointp : qAsConst(*global_waypoint_list)) {
@@ -171,7 +171,7 @@ LowranceusrFormat::lowranceusr4_find_waypt(uint uid_unit, int uid_seq_low, int u
 }
 
 const Waypoint*
-LowranceusrFormat::lowranceusr4_find_global_waypt(uint id1, uint id2, uint id3, uint id4) const
+LowranceusrFormat::lowranceusr4_find_global_waypt(uint id1, uint id2, uint id3, uint id4)
 {
   // Iterate with waypt_disp_all?
   for (const Waypoint* waypointp : qAsConst(*global_waypoint_list)) {
index a4bf4621e9fa169c69232fb15ada39ef8c9311be..34b26b916cd86c4487742904a5a3789dbf3a9a33 100644 (file)
@@ -397,8 +397,8 @@ private:
 
   static char same_points(const Waypoint*, const Waypoint*);
   void register_waypt(const Waypoint*) const;
-  const Waypoint* lowranceusr4_find_waypt(uint, int, int) const;
-  const Waypoint* lowranceusr4_find_global_waypt(uint, uint, uint, uint) const;
+  static const Waypoint* lowranceusr4_find_waypt(uint, int, int);
+  static const Waypoint* lowranceusr4_find_global_waypt(uint, uint, uint, uint);
   QString lowranceusr4_readstr(gbfile*, int) const;
   void lowranceusr4_writestr(const QString&, gbfile*, int) const;
   static gpsbabel::DateTime lowranceusr4_get_timestamp(unsigned int, unsigned int);
diff --git a/osm.cc b/osm.cc
index ee6e758ae9af0dc63ed9717efb8973877a0a741b..b76d0974426144db35f03c1dedf433dcb722c2ce 100644 (file)
--- a/osm.cc
+++ b/osm.cc
@@ -415,7 +415,7 @@ OsmFormat::osm_strip_html(const char* str)
 }
 
 QString
-OsmFormat::osm_strip_html(const QString& str) const
+OsmFormat::osm_strip_html(const QString& str)
 {
   char* r = osm_strip_html(CSTR(str));
   QString rv(r);
diff --git a/osm.h b/osm.h
index 7147322cd64a153ac092dcf06a845ef6a18186b3..609a0f419cc584c60c8c3b6ed06f23879997286c 100644 (file)
--- a/osm.h
+++ b/osm.h
@@ -97,7 +97,7 @@ private:
   char osm_feature_ikey(const QString& key) const;
   QString osm_feature_symbol(int ikey, const char* value) const;
   static char* osm_strip_html(const char* str);
-  QString osm_strip_html(const QString& str) const;
+  static QString osm_strip_html(const QString& str);
   void osm_node_end(xg_string /* unused */, const QXmlStreamAttributes* /* unused */);
   void osm_node(xg_string /* unused */, const QXmlStreamAttributes* attrv);
   void osm_node_tag(xg_string /* unused */, const QXmlStreamAttributes* attrv);
index 3137f1d679726352dc6dd1b9f4336a5946ca578d..78e529603bcc5eac13bb49ae3aab8af72abd7827 100644 (file)
--- a/polygon.h
+++ b/polygon.h
@@ -58,7 +58,7 @@ private:
     },
   };
 
-  void polytest(double lat1, double lon1,
+  static void polytest(double lat1, double lon1,
                 double lat2, double lon2,
                 double wlat, double wlon,
                 unsigned short* state, int first, int last);
index c7e66191925666e1c447c614649a6f1a5fd8c15e..dc9479e9025db655fe898af7a90e8d581d1b7717 100644 (file)
@@ -74,7 +74,7 @@ private:
     explicit WptRecord(Waypoint* w) : wpt(w) {}
   };
 
-  double gc_distance(double lat1, double lon1, double lat2, double lon2);
+  static double gc_distance(double lat1, double lon1, double lat2, double lon2);
   void position_runqueue(WaypointList* waypt_list, int qtype);
   void position_process_any_route(const route_head* rh, int type);
   void position_process_rte(const route_head* rh);
index 304f8db41881be64310ed89f21b51e8509341d53..5935c105a7c7f2996c08f4b26a6551b5dc1e03a8 100644 (file)
--- a/radius.h
+++ b/radius.h
@@ -88,7 +88,7 @@ private:
     },
   };
 
-  double gc_distance(double lat1, double lon1, double lat2, double lon2);
+  static double gc_distance(double lat1, double lon1, double lat2, double lon2);
 
 };
 #endif // FILTERS_ENABLED
index a1bcce5c22337ec96644c12c895f68f40e6d9fe2..d78a25c9329d9cd35e12b5f56cb5ff1b46c8854b 100644 (file)
@@ -126,7 +126,7 @@ private:
     const Waypoint* wpt{nullptr};
   };
 
-  void free_xte(struct xte* xte_rec);
+  static void free_xte(struct xte* xte_rec);
 
   struct xte_intermed* tmpprev = nullptr;
   int xte_count = 0;
index 82b3b8848b9b73ffa2b25345f62f90338ade6d25..5ecc9de398f688e775d264d68d9113f273ea001e 100644 (file)
@@ -178,7 +178,7 @@ private:
   bool need_time{};            /* initialized within trackfilter_init */
 
   int trackfilter_opt_count();
-  qint64 trackfilter_parse_time_opt(const char* arg);
+  static qint64 trackfilter_parse_time_opt(const char* arg);
   static bool trackfilter_init_sort_cb(const route_head* ha, const route_head* hb);
   static bool trackfilter_merge_sort_cb(const Waypoint* wa, const Waypoint* wb);
   fix_type trackfilter_parse_fix(int* nsats);
@@ -202,7 +202,7 @@ private:
 
   void trackfilter_synth();
 
-  QDateTime trackfilter_range_check(const char* timestr);
+  static QDateTime trackfilter_range_check(const char* timestr);
   void trackfilter_range();
 
   void trackfilter_seg2trk();
@@ -215,9 +215,9 @@ private:
     bool   force{false};
   };
 
-  faketime_t trackfilter_faketime_check(const char* timestr);
+  static faketime_t trackfilter_faketime_check(const char* timestr);
   void trackfilter_faketime();             /* returns number of track points left after filtering */
-  bool trackfilter_points_are_same(const Waypoint* wpta, const Waypoint* wptb);
+  static bool trackfilter_points_are_same(const Waypoint* wpta, const Waypoint* wptb);
 
   void trackfilter_segment_head(const route_head* rte);
 
index 1dc2d1e6fccdd6c4f20b20f72eae6034b127f727..7fb501a1ac5d2c4b1939978a15c45234485110e5 100644 (file)
--- a/unicsv.cc
+++ b/unicsv.cc
@@ -170,7 +170,7 @@ const UnicsvFormat::field_t UnicsvFormat::fields_def[] = {
 // Parse GC-Code / geo cache reference code into int64 (GC-ID)
 // (see also https://api.groundspeak.com/documentation#referencecodes)
 long long
-UnicsvFormat::unicsv_parse_gc_code(const QString& str) const
+UnicsvFormat::unicsv_parse_gc_code(const QString& str)
 {
   if (! str.startsWith("GC")) {
     return 0;
@@ -283,7 +283,7 @@ UnicsvFormat::unicsv_parse_date(const char* str, int* consumed)
 }
 
 time_t
-UnicsvFormat::unicsv_parse_time(const char* str, int* usec, time_t* date) const
+UnicsvFormat::unicsv_parse_time(const char* str, int* usec, time_t* date)
 {
   int hour, min, sec;
   int consumed = 0;
index 509a6ba57b140d0d4a6e4c4005c09b2f9401187d..322d1df5a11dfc5064835ceeaf5b8a631449f08c 100644 (file)
--- a/unicsv.h
+++ b/unicsv.h
@@ -172,9 +172,9 @@ private:
 
   /* Member Functions */
 
-  long long int unicsv_parse_gc_code(const QString& str) const;
+  static long long int unicsv_parse_gc_code(const QString& str);
   static time_t unicsv_parse_date(const char* str, int* consumed);
-  time_t unicsv_parse_time(const char* str, int* usec, time_t* date) const;
+  static time_t unicsv_parse_time(const char* str, int* usec, time_t* date);
   time_t unicsv_parse_time(const QString& str, int* msec, time_t* date) const;
   static status_type unicsv_parse_status(const QString& str);
   QDateTime unicsv_adjust_time(time_t time, const time_t* date) const;